package com.ruoyi.analysis.controller;

import com.ruoyi.analysis.domain.ProductAnalysisTeam;
import com.ruoyi.analysis.domain.analysis.ProductAnalysisTeamAnalysis;
import com.ruoyi.analysis.service.IProductAnalysisTeamService;
import com.ruoyi.analysis.service.analysis.ProductAnalysisTeamAnalysisService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 班组生产数据分析Controller
 *
 * @author ruoyi
 * @date 2023-01-04
 */
@Controller
@RequestMapping("/analysis/team/analysis")
public class ProductAnalysisTeamAnalysisController extends BaseController
{
    private static final String prefix = "analysis/team";

    @Resource
    private IProductAnalysisTeamService productAnalysisTeamService;
    @Resource
    private ProductAnalysisTeamAnalysisService productAnalysisTeamAnalysisService;


    @GetMapping()
    public String analysis() {
        return prefix + "/analysis";
    }

    /**
     * 查询班组生产数据列表
     */
    @PostMapping("/list")
    @ResponseBody
    public AjaxResult analysisList(ProductAnalysisTeam productAnalysisTeam)
    {
        List<ProductAnalysisTeam> list = productAnalysisTeamService.selectProductAnalysisTeamList(productAnalysisTeam);
        ProductAnalysisTeamAnalysis productAnalysisTeamAnalysis = productAnalysisTeamAnalysisService.analysis(list);
        return AjaxResult.success(productAnalysisTeamAnalysis);
    }

}
